﻿<!DOCTYPE html>
<html lang="en">
<head>
    <title>对象的反序列化</title>
</head>
<body>
    <h2>从JSON字符串中创建一个对象</h2>
    <p id="demo"></p>
    <script>
        let text = '{"employees":[' +
            '{"name":"Taobao","site":"http://www.taobao.com" },' +
            '{"name":"Google","site":"http://www.Google.com" },' +
            '{"name":"Baidu","site":"http://www.baidu.com" }]}';
        obj = JSON.parse(text);
        document.getElementById("demo").innerHTML =
            obj.employees[1].name + " " + obj.employees[1].site;
    </script>
</body>
</html>
